#include "main.h"
int main(int argc, const char *argv[])
{
	//1、创建套接字
	int C=socket(AF_INET,SOCK_STREAM,0);
	if(-1==C){perror("创建套接字失败");return -1;}
	//2、与服务器建立连接
	struct sockaddr_in addr={0};
	addr.sin_family=AF_INET;
	addr.sin_port=htons(12345);
	addr.sin_addr.s_addr=inet_addr("192.168.126.145");
	if(connect(C,(const struct sockaddr*)&addr,sizeof(addr))==-1){perror("绑定失败");return -1;}
	int pox,ret;
	while(1)
	{
		printf("请输入选项:");
		scanf("%d",&pox);
		while(getchar()!=10);
		write(C,&pox,4);
		read(C,&ret,4);
		switch(pox)
		{
		case 1://发消息
			break;
		case 2://拷贝文件
			client_write_cp(C);
			break;
		default:
			printf("无此选项\n");
		}
	}
	return 0;
}
